﻿using System.Net.Http;
using System.Threading.Tasks;

namespace HttpClientFactoryLearning
{
    public class MyGitHubClient
    {
        public MyGitHubClient(HttpClient client)
        {
            Client = client;
        }

        public HttpClient Client { get; }
    }

    public class MyGitHubClient2 : IMyGitHubClient
    {
        private readonly HttpClient _client;

        public MyGitHubClient2(HttpClient client)
        {
            _client = client;
        }

        public async Task<int> GetRootDataLength()
        {
            var data = await _client.GetStringAsync("/");
            return data.Length;
        }
    }
}
